danvi/dim1486/generalize dan perception stack - #3723
Conversation
…he window's cell range - one fancy-index lookup per snapshot's points and one rectangle memset after it
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #3723 +/- ##
==========================================
- Coverage 77.46% 77.41% -0.05%
==========================================
Files 1302 1345 +43
Lines 123061 129215 +6154
Branches 10772 11924 +1152
==========================================
+ Hits 95330 100038 +4708
- Misses 24924 25993 +1069
- Partials 2807 3184 +377
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 201 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
leshy
left a comment
There was a problem hiding this comment.
basically escaped mem2 immediately, first comments first view to push back on this, might have more stuff
test_detection3dpc pinned obb.center and obb.extent to values from when from_2d projected through a bare pinhole matrix and ignored camera_info.D. The camera under test is go2_front_camera_720p, declared equidistant. project_pixels now applies that model, shifting projected pixels by a median of 20 px and moving the suitcase OBB center 18 mm in y, just past the 0.1 window. Tolerances and the file's other assertions are unchanged.
…ocalize call in runtime
| stronger = self if self.confidence >= other.confidence else other | ||
| return Detection3DPC( | ||
| image=later.image, | ||
| bbox=later.bbox, |
There was a problem hiding this comment.
you should expand bbox, not take latest one, your result is a union now
There was a problem hiding this comment.
Do not agree, expanind is not a fix because two boxes are not in the same image. add` keeps image, bbox and transform from one and the same sighting so the union stays a valid 2D detection: the box is where the object appears in that image.
This related to a later comment. The real fix is to drop the sum
|
|
||
| span = _camera_span(rig) | ||
| rig.mobile = span > MOBILE_SPAN_M | ||
| if rig.mobile: |
There was a problem hiding this comment.
I don't think we should have these meta-settings, below is already exposed to the config
| candidates = list(self.poses.at(ts, self.tf_tolerance)) | ||
| if not candidates: | ||
| return None | ||
| earlier = [o for o in candidates if o.ts <= ts] |
There was a problem hiding this comment.
this whole function is pretty complex, there must be an easier way to find a pose at some time? if we need interpolation we should generalize somewhere
|
|
||
| def world_to_optical(self, ts: float) -> Transform | None: | ||
| ts -= self.color_delay # color stamps lag; the capture instant is earlier | ||
| if self.tf is not None: |
There was a problem hiding this comment.
should probably just insist on valid tf to not deal with special cases
|
most of these function descriptions seem ai generated and very difficult to understand |
da6b87c to
00f0c66
Compare
| # Seconds an MCP client waits for a tool to answer. A skill that thinks | ||
| # for longer than this is cut off at the client, not the server, so the | ||
| # caller owns the number. | ||
| mcp_timeout: int = 30 |
|
|
||
| logger = setup_logger() | ||
|
|
||
| DEFAULT_TIMEOUT = 30 |
There was a problem hiding this comment.
yes was bad thanks. no globals no in globalconfig
| @@ -27,6 +27,9 @@ def open_sqlite_connection(path: str | Path) -> sqlite3.Connection: | |||
| conn = sqlite3.connect(path, check_same_thread=False) | |||
| conn.execute("PRAGMA journal_mode=WAL") | |||
| conn.execute("PRAGMA synchronous=NORMAL") | |||
| # WAL has one writer at a time; concurrent writer threads (a recorder | |||
There was a problem hiding this comment.
prefer limited comments. i put in my claude.md to super limit ai comments
| """ | ||
| return self.subscribe( | ||
| lambda _: None, | ||
| on_error=lambda e: logger.error("drain_thread() pipeline died: %s", e, exc_info=e), |
There was a problem hiding this comment.
what i personally do if i have refactor code unrealted to the PR -- i PR it seperatley to keep main feature PR clean
| @@ -27,9 +28,14 @@ | |||
| from dimos.perception.detection.type.detection2d.bbox import Detection2DBBox | |||
| from dimos.perception.detection.type.detection2d.imageDetections2D import ImageDetections2D | |||
|
|
|||
| # ~3.8 MB of GPU memory per cached frame | |||
| _FEATURE_CACHE_MAX = 128 | |||
There was a problem hiding this comment.
maybe this should be global constant in constants.py but idk enough about this model
|
|
||
| class Owlv2Config(HuggingFaceModelConfig): | ||
| model_name: str = "google/owlv2-base-patch16-ensemble" | ||
| # float16 runs the forward under autocast at roughly half the latency; |
Generealize perception stack
This PR builds, improves, and adds new functionality based on the foundation of these previous PRs:
#3496
#3422
How to test and what to expect
refference machine:
Lenovo Legion laptop, AMD Ruyzen AI 7, 32GB RAM, NVIDIA RTX 5070 Laptop edition (8 GB)
Caller - operator/agent decide the localization parameters at runtime
every localize call can have own tuning parameters supplied
At the moment we have ROOM policy, and default table policy, think xArm gripper.
This accounts for different environment and rig. We can control a detection score to take only the best candidates, and an acceptance floor, you can control segmentation, etc. Check
localize.pyxArm
This uses the deault location for xArm dataset, already on main, xarm6_worldbelief_20260729_203624_161992.db.
You do not need to specify the --dataset <location_to_recording_bag_.db>
time uv run python -m dimos.perception.memory.tool_localize "roll of black tape" "book" "pen" "red marker" "yellow sticky notes" pc_xArm_all_multi.rrd --from 427 --duration 76 --multi && uv run dimos-viewer pc_xArm_all_multi.rrdG1
You will need a g1 recording for this, check this PR, it's on main already, #3527
time uv run python -m dimos.perception.memory.tool_localize "paper box" "plant in a pot" "shoes" "wooden crate" "office chair" "bag" g1_sf_120_180_localize.rrd --dataset data/g1_sf_office.db --from 120 --duration 60 --multi && uv run dimos-viewer g1_sf_120_180_localize.rrdGo2
Run on the default go2_short.db
time uv run python -m dimos.perception.memory.tool_localize "table" "white robot" "potted plants" "wooden doors" "coke bottle" "fanta bottle" "sprite bottle" "lays chips" "pillow" "green plant" "plant pot" go2_short_00_60.rrd --dataset data/go2_short.db --from 0 --duration 60 --multi && uv run dimos-viewer go2_short_00_60.rrdA live blueprint addition showcasing the localize api on the live continuous stream.
The examples streams over go2_short.db recording that comes with dimos. Queries can be executed in real-time from dimos shell or mcp calls.
Check dedicated readme for guide how to run it,
dimos/dimos/perception/memory/blueprints/README.mdImportant
Use localize() API for testing and building